package com.example.springboot3.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;

@Controller
@ResponseBody
public class UserController {
    @GetMapping("/login")
    public Object login(String userName,String passWord){
        System.out.println(userName);
        System.out.println(passWord);
        HashMap<String,Object> hashMap = new HashMap<>();
        hashMap.put("status",200);
        Integer loginState = -1;
        String message = "";
        if ("admin".equals(userName) && "admin".equals(passWord)) {
            loginState = 1;
            message = "登录成功";
        }else {
            message = "账号或密码不正确";
        }
        hashMap.put("loginState",loginState);
        hashMap.put("message",message);
        return hashMap;
    }
}
